package edu.fyvtc.javaweb.demo.common;

//用于快速创建DemoResult对象
public class ResultUtils {

    public static DemoResult success(Object data) {
        DemoResult result = new DemoResult();
        result.setCode(Constants.RESULT_CODE_SUCCESS);
        result.setMessage(Constants.RESULT_MESSAGE_SUCCESS);
        result.setData(data);
        return result;
    }

    public static DemoResult error(Object data) {
        DemoResult result = new DemoResult();
        result.setCode(Constants.RESULT_CODE_ERROR);
        result.setMessage(Constants.RESULT_MESSAGE_ERROR);
        result.setData(data);
        return result;
    }

    public static DemoResult success() {
        return success(null);
    }

    public static DemoResult error() {
        return error(null);
    }

}
